package glossos;

import glossos.parsing.Parser;
import glossos.tree.FrequencyTree;

import java.io.*;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {

	public static void main(String[] args) throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext("/application-context.xml");

		FrequencyTree frequencyTree = (FrequencyTree) context.getBean("frequencyTree");
		Parser parser = (Parser) context.getBean("stateMachine");

        frequencyTree.start();
        parser.parse();

//		LRUCache<Integer, List<String>> cache = new LRUCache<Integer, List<String>>(10);
//		new CommandLineController(new CachedSearcher(cache, frequencyTree)).run();

		frequencyTree.logResults(new BufferedWriter(new OutputStreamWriter(System.out)));
	}
}
